package com.kinon.ogt.view.widget;

import android.content.Context;
import android.support.annotation.Nullable;
import android.support.v7.widget.Toolbar;
import android.util.AttributeSet;
import android.widget.ImageView;
import android.widget.TextView;

import com.kinon.ogt.R;

/**
 * 佛祖保佑 永无BUG
 *
 * @author WangZhiYao
 * @date 2018/4/27
 */
public class FxToolbar extends Toolbar {

    private ImageView mIvBack;
    private TextView mTvTitle;

    public FxToolbar(Context context) {
        super(context);
    }

    public FxToolbar(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public FxToolbar(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();
        mIvBack = findViewById(R.id.iv_toolbar_back);
        mTvTitle = findViewById(R.id.tv_toolbar_title);
    }

    public void setTitle(String title) {
        mTvTitle.setText(title);
    }

    public void setOnBackClickListener(OnClickListener onClickListener) {
        mIvBack.setOnClickListener(onClickListener);
    }
}
